<!doctype html> 
<html> 
<head> 
  <meta charset="utf-8"/>
  <title>后台管理系统</title>
  <meta name="author" content="DeathGhost" />
  <link rel="stylesheet" type="text/css" href="css/style.css" />
  <!--[if lt IE 9]>
  <script src="js/html5.js"></script>
  <![endif]-->
  <style>
  li{float: left; }
  </style>
<script src="js/jquery.js"></script>
<script src="js/jquery.mCustomScrollbar.concat.min.js"></script>
<script>
  (function($){
    $(window).load(function(){
      
      $("a[rel='load-content']").click(function(e){
        e.preventDefault();
        var url=$(this).attr("href");
        $.get(url,function(data){
          $(".content .mCSB_container").append(data); //load new content inside .mCSB_container
          //scroll-to appended content 
          $(".content").mCustomScrollbar("scrollTo","h2:last");
        });
      });
      
      $(".content").delegate("a[href='top']","click",function(e){
        e.preventDefault();
        $(".content").mCustomScrollbar("scrollTo",$(this).attr("href"));
      });
      
    });
  })(jQuery);
</script>

</head>
<body>
      <div id="sv">
  <section class="rt_wrap content mCustomScrollbar">
 <div class="rt_content">
     



     <section>
      <h2><strong style="color:grey;"></strong></h2>

      
     
      <div class="page_title">
       <h2 class="fl">消息列表</h2>
      
      </div>
      <div style="margin-bottom:5px;">
      <input type="text" class="textbox" placeholder="搜索信息内容..." id="search"/>
      <input type="button" value="搜索" class="group_btn"  />
      </div>
      <table class="table">
       <tr>
        <th>编号</th>
        <th>发送人</th>
        <th>接收人</th>
        <th>内容</th>
        <th>发送时间</th>
        <th>操作</th>
       </tr>
       @foreach($list as $v)
       <tr>
        <td>{{$v->a_id}}</td>
        <td>{{$v->s_name}}</td>
        <td>{{$v->r_name}}</td>
        <td>{{$v->a_text}}</td>
        <td>{{date('Y-m-d H:i:s',$v->a_time)}}</td>
        <td>
         <a href="javascript:void(0);" class="dels" dels="{{$v->a_id}}">删除</a>
        </td>
       </tr>
       @endforeach
       
      </table>
      <aside class="paging">
       <?php echo $list->render() ?>
      </aside>
     </section>
     

 </div>
</section>
      </div>
</body>
<script type="text/javascript">
$('.dels').click(function(){
   var id=$(this).attr('dels');
   var dels=$(this).parent().parent();
   var data={'id':id,'_token':"{{ csrf_token() }}"};
   var url="messageList";
   $.post(url,data,function(msg){
    if(msg){
      dels.remove();
    }
   })
})


$('button').click(function(){
  var val=$('#search').val();
  var data={'val':val,'_token':"{{ csrf_token() }}",'do':'s'}
  var url="messageList";
  $.post(url,data,function(msg){
     if(msg!=''){
      $('#sv').html(msg);
     }else{
      alert('无结果');
     }
  })
})
</script>
</html>


